<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>批改作业</title>
    <meta name="viewport" content="width=device-width,initial-scale=1" />
    <link rel="stylesheet" type="text/css" href="<%=path %>/css/f/default.css"/>
	<link rel="stylesheet" type="text/css" href="<%=path %>/css/f/navs.css"/>
	<link rel="stylesheet" type="text/css" href="<%=path %>/css/f/assignment.css"/>
	<script src="js/jquery.min.js"></script>
	<script src="js/f/default.js"></script>
  </head>
  
  <body>
    <div class="all">
  		<jsp:include page="/nav.jsp"></jsp:include>
  		<div class="rightall float-left" id="seeclass">
  			<div class="already">
  				<div class="already-title">
  					<div class="left">批改作业</div>
  				</div>
	  			<form method="post" action="teacher/correting.do">
	                <div style="margin-top: 15px;">
	                	<span style=" margin-left:20%;"></span>
	                	班级:<select class="task" name="className">
                                <c:forEach var="s" items="${cour}">
                                    <option value="${s.className }">${s.className }</option>
                                </c:forEach>
	                    </select>
	                	<span style=" margin-left:50px;"></span>
	                	姓名:<input type="text" name="stuName" class="task">
	                	<span style=" margin-left:50px;"></span>
	                	<button class="task btn-style" type="submit">查找</button>
	                </div>
  				</form>
	  				<table>
	  					<tr class="tr-style-head">
	  						<td class="y-width">班级</td>
	  						<td class="y-width">姓名</td>
	  						<td class="z-width">提交时间</td>
	  						<td class="z-width">作业内容</td>
	  						<td class="y-width">作业文件</td>
	  						<td class="y-width">成绩</td>
	  						<td class="y-width">状态</td>
	  						<td class="z-width">批改(评分)</td>
	  					</tr>
	  					<c:forEach var="s" items="${works }">
		  					<tr class="tr-style">
		  						<td>${s.className }</td>
		  						<td>${s.stuName }</td>
		  						<td><fmt:formatDate value="${s.createTime}" pattern="yyyy-MM-dd hh:mm"/></td>
		  						<td>${s.workContent }</td>
		  						<td><a href="${s.workFile}" class="a-color-blue">下载</a></td>
		  						<td>${s.workLevel }</td>
		  						<td>
		  							<c:if test="${s.workLevel!=null }">
		  								<span class="span-color-blue">已批改</span>
			  						</c:if>
		  							<c:if test="${s.workLevel==null }">
			  							<span class="span-color-red">未批改</span>
		  							</c:if>
			  					</td>
		  						<td>
	  								<form method="post" action="teacher/correting.do" style="margin:0;">
	  									<input type="hidden" name="submitId" value="${s.workSubmitId}">
	  									<input type="hidden" name="pageNo" value="${pageNo }">
			  							<input type="text" name="score"<c:if test="${s.workLevel!=null}">
			  							disabled</c:if> class="td-text-style" onblur="score();">
			  							<button type="submit" class="btn-style">批改</button>
	  								</form>
		  						</td>
		  					</tr>
	  					</c:forEach>
	  				</table>
	            <c:if test="${pages > 1 }">
               		<div class="previous">
	               		<c:if test="${pageNo>1}">
	                    	<a href="teacher/correting.do?pageNo=${pageNo-1}">上一页</a>
	                	</c:if>
	                   	<c:forEach var="p" begin="1" end="${pages }" step="1">
	                   		<c:if test="${p==pageNo }">
	                   			<span style="font-size:18px;color:#446ee6;">&nbsp;${p}&nbsp;</span>
	                   		</c:if>
	                   		<c:if test="${p!=pageNo }">
	                   			<a href="teacher/correting.do?pageNo=${p }" >&nbsp;${p}&nbsp;</a>
	                   		</c:if>
	                   	</c:forEach>
	                    <c:if test="${pageNo<pages}">
	                    	<a href="teacher/correting.do?pageNo=${pageNo+1}">下一页</a>
	                	</c:if>
                   </div>
                </c:if>
  			</div>
  		</div>
  	</div>
  	<script type="text/javascript">
  		function score(){
	  		var stuscore=document.getElementByClassName("td-text-style").value;
	  		if(stuscore!=A || stuscore!=B || stuscore!=C || stuscore!=D|| stuscore!=E){
	  			alert("请输入ABCD进行评分!");
	  		}
  		}
  	</script>
  </body>
</html>
